<?php
class Merchant_Model_Validate_CnramValidate extends Merchant_Model_Validate_CommonValidate
{
	
	//收件人地址
	public function address(){
        $regex[] = array('name' => '收件人地址','value' => $this->consignee_address1,'regex' => array('require','noCharacter','length[1,150]'));
		$error=Default_Service_Validator::formValidator($regex);
		if(!empty($error)){
			foreach ($error as $one){
				$this->_error[] = $one ;
			}
		}
	}
	
	
	//收件人城市
	public function consigneeCity(){
        $regex = array('name' => '收件人城市','value' => $this->consignee_city,'regex' => array('length[1,255]','noCharacter'));
		$error = Default_Service_Validator::Validator($regex);
		if(!empty($error)){
			$this->_error[] = $error ;
		}
	}
	
	//收件人州
	public function consigneeRegion(){
		$regex = array('name' => '收件人州/区域','value' => $this->consignee_region,'regex' => array('length[1,128]','noCharacter'));
		$error = Default_Service_Validator::Validator($regex);
		if(!empty($error)){
			$this->_error[] = $error ;
		}
	}
	
	//电话
	public function consigneePhone(){
 		$regex = array('name' =>  '电话号码','value' => $this->consignee_phone,'regex' => array('length[0,15]','noCharacter'));
		$error = Default_Service_Validator::Validator($regex);
		if(!empty($error)){
			$this->_error[] = $error ;
		}
	}
	
	//邮编
	public function consigneeZip(){
		$regex = array('name' => '邮政编号','value' => $this->consignee_zip,'regex' => array('length[0,32]','noCharacter'));
		$error = Default_Service_Validator::Validator($regex);
		if(!empty($error)){
			$this->_error[] = $error ;
		}
	}
	
    public function validator(){
		$this->PublicValidator();
		$this->orderProduct();
		$this->consigneeCity();
		$this->consigneeRegion();
		$this->consigneePhone();
        $this->consigneeZip();
        return $this->_error;
    }
}